package dian.qing.li.demo.security.utils;

import lombok.experimental.UtilityClass;

/**
 * SQL工具类
 *
 * @author: liqingdian
 */
@UtilityClass
public class SqlUtils {

    /**
     * 获取mybatis-plus基本sql构造类
     *
     * @param entity 实体DTO
     * @author: liqingdian
     */
    public static <T> QueryBuilder builder(T entity) {
        QueryBuilder<T> builder = new QueryBuilder<>(entity);
        return builder;
    }

    /**
     * 获取mybatis-plus基本sql构造类
     *
     * @param entity    实体DTO
     * @param condition 实体DTO的非空属性是否作为条件
     * @author: liqingdian
     */
    public static <T> QueryBuilder builder(T entity, boolean condition) {
        QueryBuilder<T> builder = new QueryBuilder<>(entity, condition);
        return builder;
    }
}
